home *** CD-ROM | disk | FTP | other *** search
/ Deutsche Edition 1 / Deutsche Edition 1.iso / amok / 041-050 / amok41 / spiele / mastermind / txt / hilfen.mod < prev    next >
Text File  |  1993-11-04  |  11KB  |  359 lines

  1. (*********************************************************
  2.  *
  3.  *  :Program.        Abfrage , gibt BOOLEAN zurück
  4.  *  :Author.        Hans Schafft
  5.  *  :Address.        Landfriedstraße 1A - Hinterhaus
  6.  *  :Address.        6900 Heidelberg
  7.  *  :Phone.        06221 - 22416
  8.  *  :Version.        1.0
  9.  *  :Date.        1990
  10.  *  :Copyright.        PD
  11.  *  :Language.        Modula-II
  12.  *  :Translator.    M2Amiga
  13.  *
  14.  *********************************************************************)
  15.  
  16. IMPLEMENTATION MODULE Hilfen;
  17.  
  18. FROM SYSTEM    IMPORT  ADR, ADDRESS, LONGSET;
  19. FROM Str    IMPORT    Copy,Length;
  20. FROM Exec       IMPORT  MemReqs, MemReqSet, WaitPort, ReplyMsg, GetMsg;
  21. FROM Graphics    IMPORT    jam2;
  22. FROM Intuition IMPORT    GadgetPtr, WindowPtr,IntuiText,IntuiTextLength,
  23.             IntuiMessagePtr, IDCMPFlags, IDCMPFlagSet,
  24.             boolGadget, reqGadget, ActivationFlags,Request,
  25.                 ActivationFlagSet, Border, Gadget, GadgetFlagSet,
  26.                         Requester, RequesterFlagSet, InitRequester;
  27.  
  28. CONST
  29.   postext = "Wie schrecklich aufregend !";
  30.   negtext = "Außerordentlich interessant !";
  31.  
  32.   XPosition = 10;
  33.   YPosition = 30;
  34.  
  35.   Zeile1 = "Durch Klicken auf die Pfeile kann man die Zahl der Kästchen";
  36.   Zeile2 = "als auch die der Farben erhöhen oder vermindern.";
  37.   Zeile3 = " ";
  38.   Zeile4 = "Hat man seine WunschKonstellation erstellt, Klick auf 'SPIEL'.";
  39.   Zeile5 = " ";
  40.   Zeile6 = "Jetzt erscheint, wenn AnzahlDerFarben >= AnzahlDerKästchen,";
  41.   Zeile7 = "ein weiterer Requester, der fragt ob jede Farbe nur einmal";
  42.   Zeile8 = "oder mehrmals vorkommen darf. Hat man dies beantwortet, so";
  43.   Zeile9 = "beginnt das Spiel:";
  44.   Zeile10 = "Die noch unausgefüllten Kästchen erscheinen links oben.";
  45.   Zeile11 = "Man wähle jetzt eine der Farben durch anklicken aus, - der Maus-";
  46.   Zeile12 = "Zeiger erhält die aktuelle Farbe - und setzte sie durch An-";
  47.   Zeile13 = "klicken in das gewünschte Kästchen. Hat man so alle Kistchen";
  48.   Zeile14 = "gefüllt, bitte das 'OK' Gadget betätigen.";
  49.   Zeile15 = " ";
  50.   Zeile16 = "Nun rückt alles eine Reihe nach unten und zwei Zahlen erscheinen.";
  51.   Zeile17 = "Die erste heißt: Soviele Kästchen hast Du mit der richtigen Farbe";
  52.   Zeile18 = "gefüllt. Die zweite: Soviele Farben sind sonst noch richtig,";
  53.   Zeile19 = "allerdings leider nicht im richtigen Kästchen! Das Spiel ist";
  54.   Zeile20 = "beendet, wenn die erste Zahl gleich der Anzahl der Kisten ist.";
  55.   Zeile21 = " ";
  56.   Zeile22 = "Um den Beginn zu vereinfachen kann man auch direkt OK klicken.";
  57.   Zeile23 = "Das hat beim MehrfachModus die Folge, daß in alle Kistchen die";
  58.   Zeile24 = "erste Farbe gesetzt wird, sonst werden die Farben der Reihe nach";
  59.   Zeile25 = "in die Kistchen gesetzt.";
  60.   Zeile26 = " ";
  61.   Zeile27 = "Kästchen,die nicht verändert werden sollen, brauchen nicht neu";
  62.   Zeile28 = "gefüllt zu werden. Ihre Farbe wird beim nächsten OK von der darunter";
  63.   Zeile29 = "liegenden Reihe übernommen.";
  64.   Zeile30 = " ";
  65.   Zeile31 = "VORSICHT! Klickt man während des Spiels 'NEU', wird alles gelöscht!";
  66.   Zeile32 = " ";
  67.   Zeile33 = "Klickt man während des Spieles das 'Hilfe'-Gadget an, verfärbt";
  68.   Zeile34 = "sich der Bildschirm blau. Jeder Klick auf eines der Kästchen";
  69.   Zeile35 = "offenbart nun seine Farbe. Aus dem Hilfe - Modus kommt man nur";
  70.   Zeile36 = "durch erneutes Anklicken von 'HILFE' !!";
  71.   Zeile37 = " ";
  72.   Zeile38 = "Die DruckerAusgabe kann durch erneutes Anwählen wieder ausge-";
  73.   Zeile39 = "schaltet werden.";
  74.   Zeile40 = " ";
  75.   Zeile41 = "Um die PfeilImages einzubinden habe ich IFFToCode von AMOK #3";
  76.   Zeile42 = "benutzt. Dem Autor Pit Burkhardt auf diesem Wege vielen Dank !";
  77.   Zeile43 = "§";
  78.  
  79.  
  80.   ReqTextFarbeVorne = 13;
  81.   ReqTextFarbeHinten = 14;
  82.   ReqBackFill = 14;
  83.   ReqRandFarbe = 4;
  84.  
  85.   posGadTextFarbeVorne = 1;
  86.   posGadTextFarbeHinten = 0;
  87.   posGadRandFarbe = 3;
  88.   negGadTextFarbeVorne = 1;
  89.   negGadTextFarbeHinten = 0;
  90.   negGadRandFarbe = 3;
  91.  
  92. VAR
  93.   RequBreite    : INTEGER;
  94.   RequHoehe    : INTEGER;
  95.   posGadBreite    : INTEGER;
  96.   negGadBreite    : INTEGER;
  97.   requester    : Requester;
  98.   posGadText    : IntuiText;
  99.   posGad    : Gadget;
  100.   posGadBorder    : Border;
  101.   posGadEcken    : ARRAY [1..10] OF INTEGER;
  102.   negGadText    : IntuiText;
  103.   negGad    : Gadget;
  104.   negGadBorder    : Border;
  105.   negGadEcken    : ARRAY [1..10] OF INTEGER;
  106.   ReqBorder    : Border;
  107.   ReqEcken    : ARRAY [1..10] OF INTEGER;
  108.   text        : ARRAY [0..43],[0..75] OF CHAR;
  109.   itext        : ARRAY [0..43] OF IntuiText;
  110.  
  111. (******************************************************************)
  112. PROCEDURE ZeigeHilfen(wiPtr : WindowPtr) : BOOLEAN;
  113. VAR
  114.   gadPtr    : GadgetPtr;
  115.   gadNr        : INTEGER;
  116.   msgPtr    : IntuiMessagePtr;
  117.   class     : IDCMPFlagSet;
  118.   code        : CARDINAL;
  119.   ende,mode    : BOOLEAN;
  120. BEGIN
  121.   IF Request(ADR(requester),wiPtr) THEN
  122.  
  123.     ende := FALSE;mode := TRUE;
  124.     REPEAT
  125.       WaitPort(wiPtr^.userPort);
  126.       LOOP
  127.         msgPtr := GetMsg(wiPtr^.userPort);
  128.         IF msgPtr=NIL THEN EXIT END;
  129.  
  130.         class := msgPtr^.class;
  131.         code  := msgPtr^.code;
  132.         gadPtr:= msgPtr^.iAddress;
  133.         gadNr := gadPtr^.gadgetID;
  134.  
  135.         ReplyMsg(msgPtr);
  136.  
  137.         IF (class = IDCMPFlagSet{gadgetUp}) THEN
  138.           CASE gadNr OF
  139.           | 1 : mode := TRUE;  ende := TRUE;
  140.           | 2 : mode := FALSE; ende := TRUE;
  141.           ELSE
  142.           END;
  143.         END;
  144.         IF ende THEN EXIT END;
  145.       END; (* LOOP *)
  146.     UNTIL ende;
  147.   END;
  148.   RETURN mode;
  149. END ZeigeHilfen;
  150.  
  151. (******************************************************************)
  152. PROCEDURE RichteEinGadgetJa;
  153. BEGIN
  154.  
  155.   WITH posGadText DO
  156.    leftEdge := 1;            topEdge    := 1;
  157.    frontPen := posGadTextFarbeVorne;    backPen := posGadTextFarbeHinten;
  158.    drawMode := jam2;            iText   := ADR(postext);
  159.    iTextFont:= NIL;            nextText:= NIL;
  160.   END;
  161.  
  162.   posGadBreite := IntuiTextLength(ADR(posGadText));
  163.  
  164.    (* Koordinaten für den Rand der Gadget Box *)
  165.   posGadEcken[1] := 0;              posGadEcken[2] := 0;
  166.   posGadEcken[3] := posGadBreite+2; posGadEcken[4] := 0;
  167.   posGadEcken[5] := posGadBreite+2; posGadEcken[6] := 11;
  168.   posGadEcken[7] := 0;              posGadEcken[8] := 11;
  169.   posGadEcken[9] := 0;              posGadEcken[10]:= 0;
  170.  
  171.   WITH posGadBorder DO
  172.     leftEdge := -1;             topEdge  := -1;
  173.     frontPen := posGadRandFarbe;    backPen  := ReqBackFill;
  174.     drawMode := jam2;                  count    := 5;
  175.     xy       := ADR(posGadEcken);     nextBorder := NIL;
  176.   END;
  177.  
  178.   WITH posGad DO
  179.    leftEdge      :=  10;
  180.    topEdge      :=  RequHoehe - 15;
  181.    width      :=  posGadBreite;
  182.    height     :=  10;
  183.    flags      :=  GadgetFlagSet{};
  184.    activation     :=  ActivationFlagSet{endGadget, relVerify};
  185.    gadgetType     :=  boolGadget + reqGadget;
  186.    gadgetRender :=  ADR(posGadBorder);
  187.    gadgetText     :=  ADR(posGadText);
  188.    mutualExclude:=  LONGSET{};
  189.    nextGadget     :=  ADR(negGad);
  190.    selectRender :=  NIL;
  191.    specialInfo     :=  NIL;
  192.    userData     :=  NIL;
  193.    gadgetID    :=  1;
  194.   END;
  195.  END RichteEinGadgetJa;
  196.  
  197. (******************************************************************)
  198. PROCEDURE RichteEinGadgetNein;
  199. BEGIN
  200.  
  201.   WITH negGadText DO
  202.    leftEdge := 1;            topEdge    := 1;
  203.    frontPen := negGadTextFarbeVorne;    backPen := negGadTextFarbeHinten;
  204.    drawMode := jam2;            iText   := ADR(negtext);
  205.    iTextFont := NIL;            nextText := NIL;
  206.   END;
  207.  
  208.   negGadBreite := IntuiTextLength(ADR(negGadText));
  209.  
  210.    (* Koordinaten für den Rand der Gadget Box *)
  211.   negGadEcken[1] := 0;              negGadEcken[2] := 0;
  212.   negGadEcken[3] := negGadBreite+2; negGadEcken[4] := 0;
  213.   negGadEcken[5] := negGadBreite+2; negGadEcken[6] := 11;
  214.   negGadEcken[7] := 0;              negGadEcken[8] := 11;
  215.   negGadEcken[9] := 0;              negGadEcken[10] := 0;
  216.  
  217.   WITH negGadBorder DO
  218.     leftEdge := -1;             topEdge  := -1;
  219.     frontPen := negGadRandFarbe;    backPen  := ReqBackFill;
  220.     drawMode := jam2;                  count    := 5;
  221.     xy       := ADR(negGadEcken);    nextBorder := NIL;
  222.   END;
  223.  
  224.   WITH negGad DO
  225.     leftEdge       := RequBreite - (negGadBreite + 14);
  226.     topEdge       := RequHoehe - 15;
  227.     width       := negGadBreite;
  228.     height     := 10;
  229.     flags       := GadgetFlagSet{};
  230.     activation      := ActivationFlagSet{endGadget, relVerify};
  231.     gadgetType      := boolGadget + reqGadget;
  232.     gadgetRender := ADR(negGadBorder);
  233.     gadgetText      := ADR(negGadText);
  234.     mutualExclude:= LONGSET{};
  235.     nextGadget      := NIL;
  236.     selectRender := NIL;
  237.     specialInfo  := NIL;
  238.     userData      := NIL;
  239.     gadgetID      := 2;
  240.   END;
  241.  END RichteEinGadgetNein;
  242.  
  243. (******************************************************************)
  244. PROCEDURE RichteEinRequesterText;
  245. VAR x,y :CARDINAL;
  246. BEGIN
  247.   Copy(text[43],"§");
  248.   RequBreite := 0;
  249.   x := 0;
  250.   REPEAT
  251.     WITH itext[x] DO
  252.       drawMode  := jam2;  iText    := ADR(text[x]);
  253.       iTextFont := NIL;   nextText := ADR(itext[x+1]);
  254.       topEdge   := x*10;
  255.       frontPen  := ReqTextFarbeVorne;
  256.       backPen   := ReqTextFarbeHinten;
  257.     END;
  258.     IF RequBreite < IntuiTextLength(ADR(itext[x])) THEN
  259.       RequBreite := IntuiTextLength(ADR(itext[x]));
  260.     END;
  261.     INC(x);
  262.   UNTIL text[x,0] = "§";
  263.  
  264.   RequHoehe := x*10 + 23;
  265.   RequBreite := RequBreite + 40;
  266.  
  267.   itext[x-1].nextText := NIL;
  268.  
  269.   FOR y := 0 TO x-1 DO
  270.     itext[y].leftEdge := (RequBreite - IntuiTextLength(ADR(itext[y]))) DIV 2;
  271.   END;
  272.  
  273. END RichteEinRequesterText;
  274.  
  275. (******************************************************************)
  276. PROCEDURE RichteEinRequester;
  277. BEGIN
  278.   RichteEinRequesterText;
  279.   RichteEinGadgetJa;
  280.   RichteEinGadgetNein;
  281.  
  282.   ReqEcken[1] := 0;              ReqEcken[2] := 0;
  283.   ReqEcken[3] := RequBreite-3;   ReqEcken[4] := 0;
  284.   ReqEcken[5] := RequBreite-3;   ReqEcken[6] := RequHoehe-3;
  285.   ReqEcken[7] := 0;              ReqEcken[8] := RequHoehe-3;
  286.   ReqEcken[9] := 0;              ReqEcken[10] := 0;
  287.  
  288.   WITH ReqBorder DO
  289.     leftEdge := 1;             topEdge  := 1;
  290.     frontPen := ReqRandFarbe;        backPen  := ReqBackFill;
  291.     drawMode := jam2;                  count    := 5;
  292.     xy       := ADR(ReqEcken);         nextBorder := NIL;
  293.   END;
  294.  
  295.   InitRequester(ADR(requester));
  296.  
  297.   WITH requester DO
  298.     leftEdge    := XPosition;
  299.     topEdge    := YPosition;
  300.     width    := RequBreite;
  301.     height    := RequHoehe;
  302.     reqGadget    := ADR(posGad);
  303.     reqText    := ADR(itext[0]);
  304.     reqBorder    := ADR(ReqBorder);
  305.     backFill    := ReqBackFill;
  306.   END;
  307.  
  308.  END RichteEinRequester;
  309.  
  310. (******************************************************************)
  311. (******************************************************************)
  312. BEGIN
  313.   Copy(text[1],Zeile1);
  314.   Copy(text[2],Zeile2);
  315.   Copy(text[3],Zeile3);
  316.   Copy(text[4],Zeile4);
  317.   Copy(text[5],Zeile5);
  318.   Copy(text[6],Zeile6);
  319.   Copy(text[7],Zeile7);
  320.   Copy(text[8],Zeile8);
  321.   Copy(text[9],Zeile9);
  322.   Copy(text[10],Zeile10);
  323.   Copy(text[11],Zeile11);
  324.   Copy(text[12],Zeile12);
  325.   Copy(text[13],Zeile13);
  326.   Copy(text[14],Zeile14);
  327.   Copy(text[15],Zeile15);
  328.   Copy(text[16],Zeile16);
  329.   Copy(text[17],Zeile17);
  330.   Copy(text[18],Zeile18);
  331.   Copy(text[19],Zeile19);
  332.   Copy(text[20],Zeile20);
  333.   Copy(text[21],Zeile21);
  334.   Copy(text[22],Zeile22);
  335.   Copy(text[23],Zeile23);
  336.   Copy(text[24],Zeile24);
  337.   Copy(text[25],Zeile25);
  338.   Copy(text[26],Zeile26);
  339.   Copy(text[27],Zeile27);
  340.   Copy(text[28],Zeile28);
  341.   Copy(text[29],Zeile29);
  342.   Copy(text[30],Zeile30);
  343.   Copy(text[31],Zeile31);
  344.   Copy(text[32],Zeile32);
  345.   Copy(text[33],Zeile33);
  346.   Copy(text[34],Zeile34);
  347.   Copy(text[35],Zeile35);
  348.   Copy(text[36],Zeile36);
  349.   Copy(text[37],Zeile37);
  350.   Copy(text[38],Zeile38);
  351.   Copy(text[39],Zeile39);
  352.   Copy(text[40],Zeile40);
  353.   Copy(text[41],Zeile41);
  354.   Copy(text[42],Zeile42);
  355.   Copy(text[43],"§");
  356.  
  357.   RichteEinRequester;
  358. END Hilfen.
  359.